//
//  NYTextField.m
//  BS
//
//  Created by neal on 15/8/16.
//  Copyright (c) 2015年 Neal. All rights reserved.
//

#import "NYTextField.h"
#define NYPlaceholderColor @"placeholderLabel.textColor"
@implementation NYTextField

- (void)awakeFromNib
{
    self.tintColor = [UIColor whiteColor];
    [self addTarget:self action:@selector(begin) forControlEvents:UIControlEventEditingDidBegin];
    [self addTarget:self action:@selector(end) forControlEvents:UIControlEventEditingDidEnd];
    [self end];
}
-(void)begin
{
    [self setValue:[UIColor whiteColor] forKeyPath:NYPlaceholderColor];
}
- (void)end
{
    [self setValue:[UIColor grayColor] forKeyPath:NYPlaceholderColor];
}
/*
- (void)drawPlaceholderInRect:(CGRect)rect
{
    rect.size.height = self.font.lineHeight;
    rect.origin.y = (self.height - rect.size.height)*0.5;
    
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    
    attrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
    attrs[NSFontAttributeName] = self.font;
    [self.placeholder drawInRect:rect withAttributes:attrs];
}
*/
@end
